import {getApplyLog} from '../../../services/basicCenter';

export default {

    namespace : 'channelManageDetail',

    state : {
        data:[],
        page:{},
        totalAmount:0,
        data1: [
            {
                label: 'companyCode',
                text: '201848770'
            }, {
                label: 'memberNumber'
            }, {
                label: 'state'
            }, {
                label: 'state',
                selectList: [
                    {
                        value: 'jack'
                    }, {
                        value: 'jack1'
                    }, {
                        value: 'jack2'
                    }
                ]
            }, {
                label: 'state'
            }, {
                label: 'state'
            }, {
                label: 'state'
            }, {
                label: 'state',
                selectList: [
                    {
                        value: 'jack'
                    }, {
                        value: 'jack1'
                    }, {
                        value: 'jack2'
                    }
                ]
            }
        ],
        data2: [
            {
                label: 'companyCode',
                text: '201848770'
            }, {
                label: 'memberNumber'
            }, {
                label: 'state'
            }, {
                label: 'state',
                selectList: [
                    {
                        value: 'jack'
                    }, {
                        value: 'jack1'
                    }, {
                        value: 'jack2'
                    }
                ]
            }, {
                label: 'state'
            }
        ],
    },

    subscriptions : {
        setup({dispatch, history}) {
            history.listen((location) => {
                if (location.pathname === '/basicCenter/channelManageDetail') {
                    dispatch({
                        type: 'getApplyLog',
                        payload:{
                        }
                      })
                }
            })

        }
    },
    effects : {
        * getApplyLog({
            payload
        }, {call, put,select}) {
            const applyLogData = yield call(getApplyLog, payload);
            const {data,page,totalAmount}=applyLogData
            yield put({
              type: 'save',
              payload:{
                data,
                page,
                totalAmount
              }
            })
        }
    },
    reducers : {
        save(state, action) {
            return {
                ...state,
                ...action.payload
            }
        }
    }

}